<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>舱室患者列表</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <style>
        [v-cloak] {
            display: none;
        }

        html,
        body {
            background-color: transparent;
        }

        .expend-cabin-wrapper>span {
            display: inline-block;
            font-size: 14px;
        }

        .aui-btn-info.add-cabin-info-btn {
            position: fixed;
            right: 10px;
            bottom: 100px;
        }

        .cabin-info {
            position: fixed;
            top: 0px;
            left: 0;
            z-index: 100;
            height: 100vh;
            width: 100%;
            background-color: rgba(255, 255, 255, 1);
            overflow: auto;
        }

        .add-cabin-info {
            width: 100%;
        }

        .aui-card-list {
            margin-top: 28px;
            background-color: transparent;
            margin-bottom: 0 !important;
        }

        .aui-btn-sm {
            width: 300px;
            margin: 20px auto;
        }

        .aui-list-item.aui-list-item-middle {
            width: 95%;
            margin: 0 auto;
            border-radius: 10px;
            -moz-box-shadow: 1px 4px 20px #C2C2C2;
            -webkit-box-shadow: 1px 4px 20px #C2C2C2;
            box-shadow: 1px 4px 20px #C2C2C2;
        }

        .aui-list-item-text {
            display: -webkit-flex;
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }

        .aui-list-item-text>span {
            flex: 1;
        }

        .patient-container {
            display: -webkit-flex;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            padding: 0 15px;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            height: 600px;
            overflow-y: auto;
            padding-bottom: 10px;
        }

        .patient-wrapper {
            background-color: #fff;
            padding: 10px;
            border-radius: 10px;
            -moz-box-shadow: 1px 4px 20px #C2C2C2;
            -webkit-box-shadow: 1px 4px 20px #C2C2C2;
            box-shadow: 1px 4px 20px #C2C2C2;
            width: 49%;
            margin-top: 27px;
        }

        .aui-tab {
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            float: left;
        }

        .aui-tab>div {
            width: 100px;
            height: 50px;
        }

        .aui-tab::after {
            display: none;
        }

        .aui-padded-5 {
            float: left;
        }

        .tab-container {
            display: -webkit-flex;
            display: flex;
            justify-content: flex-start;
            width: 94%;
            margin: 0 auto;
        }

        .tab-container>div:nth-child(1) {
            width: 25%;
        }

        .tab-container>div:nth-child(1)>div {
            width: 100%;
            text-align: center;
        }

        .tab-container>div:nth-child(2) {
            width: 75%;
            background-color: #fff;
            text-align: left;
        }

        #tab {
            border-radius: 10px;
        }

        .aui-list.aui-media-list::after,
        .aui-list.aui-media-list::before {
            display: none !important;
        }

        .patient-list-fix-bottom {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            /* height: 2rem; */
            background-color: #fff;
        }

        .patient-list-fix-bottom>div {
            display: -webkit-flex;
            display: flex;
            justify-content: space-around;
            align-items: center;
            height: 72px;
            line-height: 72px;
        }

        .patient-list-fix-bottom>div>div {
            width: 25%;
            text-align: center;
            height: 60px;
            line-height: 60px;
        }

        .patient-list-fix-bottom>div>div>span {
            float: left;
            height: 60px;
            line-height: 60px;
            display: inline-block;
        }

        .patient-list-fix-bottom>div>div>span:nth-child(1) {
            width: 35%;
        }

        .patient-list-fix-bottom>div>div>span:nth-child(2) {
            width: 65%;
        }

        .patient-list-fix-bottom>div>div>span>i {
            display: inline-block;
            width: 20px;
            height: 15px;
            margin-left: 15px;
        }

        .aui-label-blue {
            background-color: #a1d4cf;
        }

        .orange {
            background-color: #ff9900;
            color: #ffffff
        }

        .patient-list-fix-bottom>div:nth-child(2)>div:nth-child(1)>span>i {
            background-color: #d81e06;
        }

        .patient-list-fix-bottom>div:nth-child(2)>div:nth-child(2)>span>i {
            background-color: #1296db;
        }

        /* ------------------------------------------------------------- */

        .aui-list-item-title,
        .aui-list-item-text>span,
        .aui-font-size-14,
        .patient-list-fix-bottom>div>div>span {
            color: #fff !important;
        }

        .patient-list-fix-bottom>div>div>span:nth-child(1)>img {
            width: 30px;
            height: 30px;
            vertical-align: middle;
            margin-left: 20px;
        }

        .patient-list-fix-bottom>div>div:nth-child(2)>span:nth-child(1)>img {
            width: 35px;
            height: 35px;
            vertical-align: middle;
            margin-left: 20px;
        }

        .cabin-info {
            position: fixed;
            left: 0;
            z-index: 1000;
            height: 150vh;
            width: 100%;
            background-color: rgba(255, 255, 255, 1);
            overflow: auto;
        }

        .circle {
            border-radius: 50%;
            width: 30px;
            height: 30px;
            color: #fff;
            text-align: center;
            line-height: 30px;
        }

        /* 新样式 */
        .weizhi {
            display: inline-block;
            height: 24px;
            width: 24px;
        }

        .weizhi img {
            height: 100%;
            width: 100%;
        }

        .sex {
            display: inline-block;
            height: 20px;
            width: 20px;
        }

        .sex img {
            height: 100%;
            width: 100%;
        }

        .list-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.6rem 0.2rem;
            border-bottom: 1px dashed #f2f2f2;
        }

        .list-con {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.2rem 0.2rem 0;
        }

        .list-con span {
            width: 50%;
            text-align: left;
        }

        .con-text {
            color: #666;
            font-size: 0.6rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .font-size {
            font-size: 0.6rem;
        }

        .aui-form-list {
            text-align: center !important;
        }
    </style>
</head>

<body>
    <main id="app">
        <div class="aui-card-list">
            <div class="aui-card-list-content">
                <ul class="aui-list aui-media-list">
                    <li class="aui-list-item aui-list-item-middle" style="margin-top: 10px;background: #84c1ff;">
                        <div class="aui-media-list-item-inner">
                            <div class="aui-list-item-media">
                                <img src="../image/avatar3.png" class="aui-img-round aui-list-img-sm"
                                    onclick="cabinfRequencyPositionFrame()">
                                <div class="aui-badge" style="background: #f89292" id="CabinTimes_countSR"></div>
                            </div>
                            <div class="aui-list-item-inner">
                                <div class="aui-list-item-text">
                                    <span id="cfName">舱次名称：</span>
                                    <span id="cfPressure">治疗压力：</span>

                                </div>
                                <div class="aui-list-item-text">
                                    <span id="cfCompression">升压时间：</span>
                                    <span id="cfStablePressure">稳压时间：</span>
                                </div>
                                <div class="aui-list-item-text">
                                    <span id="cfDecompression">减压时间：</span>
                                    <span id="cfOutCabin">出舱时间：</span>
                                </div>
                                <div class="aui-list-item-text">
                                    <span id="cfStartTime">开始时间：</span>
                                    <span id="corTotalNumberPeople">总人数：</span>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="patient-container">
            <!-- 主体信息 -->
            <template id="cabin_information">

            </template>
        </div>
        <!-- <section class="patient-list-fix-bottom" style="background: #84c1ff;" @touchmove.prevent>
            <div>
                <div>
                    <span><img src="../image/renshu.png"></span>
                    <span id="RenShuCount">人数：</span>
                </div>
                <div>
                    <span><img src="../image/zuowei1.png"></span>
                    <span id="ZuoWeiCount">坐位</span>
                </div>
                <div>
                    <span><img src="../image/woshi.png"></span>
                    <span id="WoWeiCount">卧位：</span>
                </div>
            </div>
            <div>
                <div>
                    <span><i></i></span>
                    <span>空位</span>
                </div>
                <div>
                    <span><i></i></span>
                    <span>站位</span>
                </div>
                <div>
                    <span><img src="../image/nan2.png"></span>
                    <span id="NanCount">男：</span>
                </div>
                <div>
                    <span><img src="../image/nv2.png"></span>
                    <span id="NvCount">女：</span>
                </div>
            </div>
        </section> -->
        <div class="cabin-info" id="cabin-info" style="display: none;">
            <div class="aui-content aui-margin-b-15">
                <section class="hospital">
                    <!-- 搜索 -->

                    <div class="top-search clearfix">
                        <!-- 输入框 -->
                        <div class="aui-searchbar-input aui-border-radius">
                            <i class="aui-iconfont aui-icon-search"></i>
                            <input type="search" placeholder="请输入搜索内容" id="aiName">
                        </div>
                        <!-- 按钮 -->
                        <div class="aui-pull-right aui-btn" tapmode onclick="getHoTreatmentRegister()">
                            <span class="aui-iconfont aui-icon-search"></span>
                        </div>
                    </div>
                </section>
                <ul class="aui-list aui-form-list">
                    <li class="aui-list-item aui-list-item-form">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                <span style="color: #23b7e5;">姓名</span>
                            </div>
                            <div class="aui-list-item-label">
                                <span style="color: #23b7e5;">体位</span>
                            </div>
                            <div class="aui-list-item-label">
                                <span style="color: #23b7e5;">吸氧</span>
                            </div>
                            <div class="aui-list-item-label">
                                <span style="color: #23b7e5;">压力</span>
                            </div>
                            <div class="aui-list-item-label">
                                <span style="color: #23b7e5;">操作</span>
                            </div>
                        </div>
                    </li>
                </ul>
                <ul class="aui-list aui-form-list" id="patient_information">

                </ul>
                <p class="add-cabin-info">
                <div class="aui-bar aui-bar-btn aui-bar-btn-round aui-btn-sm" style="width:45%;">
                    <div class="aui-bar-btn-item aui-active" onclick="Cancel()">取消</div>
                </div>
                </p>
                <div style="height:450px"></div>
            </div>
        </div>
    </main>
    <!-- 舱次位置id隐藏域 -->
    <input type="hidden" id="cfpId">
    <!-- 当前舱次压力隐藏域 -->
    <input type="hidden" id="cfPressurehide">
</body>

</html>

<script src="../script/api.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/vue.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/jquery.min.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/ToConfigure.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-toast.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-dialog.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-tab.js" charset="utf-8" type="text/javascript"></script>
<script type="text/javascript">
    var vm = null;
    //定义toast提示框
    var toast = new auiToast();
    //获取ip地址
    var Url_IP = ToConfigure_IP("Gorgeous");
    apiready = function () {
        vm = new Vue({
            el: '#app',
            data: {
                AddPersonnel: false, //隐藏信息
                CabinInformation: [], //舱内人员信息
                AddingPatientInformation: [], //需要添加的人员信息
                ID: 0, //舱次Id
                LocationI: 0, //位置ID
                Url_IP: ""
            },
            created() {
                //清空舱次位置id
                $("#cfpId").val("0");
                api.showProgress({
                    title: '努力加载中...',
                    text: '',
                    modal: true
                });
                //查询舱内患者
                getHoCabinFrequencyPosition();
                //查询患者信息
                getHoTreatmentRegister();
                api.hideProgress();
            },
            methods: {
            }
        })

        /**
         * 通知当前本模块app进入后台。此时模块会进行一些资源的暂停存储操作，防止照相机回来之后黑屏
         * 
        */
        var FNScanner = api.require('FNScanner');
        api.addEventListener({
            name: 'pause'
        }, function (ret, err) {
            FNScanner.onPause();
            // alert('应用进入后台');
        });


        /**
         * 通知当前本模块app进入回到前台。此时模块会进行一些资源的恢复操作，防止照相机回来之后黑屏
         * 
        */
        api.addEventListener({
            name: 'resume'
        }, function (ret, err) {
            FNScanner.onResume();
            // alert('应用回到前台');
        });

    }

    /**
* 查询舱次位置排仓人数总和
* @param currPage 当前页
*/
    function getHoCabinFrequencyPeople(cfId) {
        var jsParms = new Object();
        /**
         * 舱次唯一标识
         */
        jsParms.cfId = cfId;
        /**
         * 舱次位置唯一标识
         */
        jsParms.cfpCfId = cfId;
        /**
         * 验证是否为空
         */
        if (jsParms.cfId == 0 || jsParms.cfId == undefined || jsParms.cfId == null) {
            return;
        }

        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/getHoCabinFrequencyPeople',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                /**
                 * 验证返回信息是否为空
                 */
                if (result.length > 0) {
                    /**
                     *  循环object
                     */
                    $.each(result, function (i, o) {
                        $("#corTotalNumberPeople").html("");
                        $("#corTotalNumberPeople").html("总人数：" + o.zong);
                    })
                } else {
                    api.hideProgress();
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "操作失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "操作失败",
                    duration: 2000
                });
            }
        });
    }


    /**
       * 查询舱次位置表
       */
    function getHoCabinFrequencyPosition() {
        var cfId = api.pageParam.F_id;
        $("#cabin_information").html("");
        getHoCabinFrequencyPeople(cfId);
        var jsParms = new Object();
        /**
         * 赋值舱次Id
         */
        jsParms.cfpCfId = cfId;
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/getHoCabinFrequencyPosition',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                // console.log(JSON.stringify(result));
                /**
                 *  拼接展示信息
                 */
                var cabin_information = "";
                /**
                 * 验证返回信息是否为空
                 */
                if (result.success == true) {
                    /**
                     *  循环object
                     */
                    $.each(result.data.list, function (i, o) {
                        if (o.cfpTrId > 0) {
                            cabin_information += "<div class='patient-wrapper'>";
                            cabin_information += "<div class='list-top'>";
                            cabin_information += " <span><div class='circle' style='background-color:#f89292'>" + (i + 1) + "</div></span>";
                            //判断是否陪同家属
                            if (o.cfpEscortCabin == 1) {
                                if (o.hoArchivalInformationEntity.aiGender == "男") {
                                    cabin_information += " <span class='name'>" + o.hoArchivalInformationEntity.aiName + "(陪同家属)<span class='sex'><img src='../image/nan2.png'></span></span>";
                                } else {
                                    cabin_information += " <span class='name'>" + o.hoArchivalInformationEntity.aiName + "(陪同家属)<span class='sex'><img src='../image/nv2.png'></span></span>";
                                }
                            } else {
                                if (o.hoArchivalInformationEntity.aiGender == "男") {
                                    cabin_information += " <span class='name'>" + o.hoArchivalInformationEntity.aiName + "<span class='sex'><img src='../image/nan2.png'></span></span>";
                                } else {
                                    cabin_information += " <span class='name'>" + o.hoArchivalInformationEntity.aiName + "<span class='sex'><img src='../image/nv2.png'></span></span>";
                                }
                            }
                            if (o.hoTreatmentRegisterEntity.trIsUnsafe == true) {
                                cabin_information += " <span class='aui-label aui-label-primary' style='margin-right: -50px' onclick=\"unsafeFactorsFrame(" + o.hoTreatmentRegisterEntity.trId + ")\">注</span>";
                                cabin_information += "<br/>"
                            }
                            cabin_information += " <span class='aui-label aui-label-primary' style='margin-right: -50px' onclick=\"complicationFrame( " + o.cfpCfId + "," + o.cfpTrId + ")\">并</span>";
                            // cabin_information +="<span class='aui-label orange'>并</span>";
                            cabin_information += " <span class='weizhi'></span>";
                            cabin_information += " </div>";
                            // cabin_information += "<div class='list-con'>";
                            // cabin_information += " <span class='con-text'  style='width:100%!important;'><b>住院号:</b>" + o.hoTreatmentRegisterEntity.trDiagnosis + "</span>";
                            // cabin_information += " </div>";
                            cabin_information += " <div class='list-con'>";
                            cabin_information += " <span class='con-text'><b>患者来源:</b> " + o.hoTreatmentRegisterEntity.trSource + "</span>";
                            if(o.hoMedicalOrderEntity.moPosition=="座位"){
                            cabin_information += " <span class='con-text'><b>患者体位:</b>" + o.hoMedicalOrderEntity.moPosition + "</span>";
                            }else if(o.hoMedicalOrderEntity.moPosition=="卧"){
                            cabin_information += " <span class='con-text' style='color: red'><b>患者体位:</b>" + o.hoMedicalOrderEntity.moPosition + "</span>";    
                            }else {
                            cabin_information += " <span class='con-text'><b>患者体位:</b>暂无</span>";    
                            }
                            cabin_information += " </div>";
                            cabin_information += "<div class='list-con'>";
                            if(o.hoMedicalOrderEntity.moEcgMonitoring=="1"){
                            cabin_information += " <span class='con-text' style='color: red'><b>心电监护:</b>有</span>";
                            }else if(o.hoMedicalOrderEntity.moEcgMonitoring=="2"){
                                cabin_information += " <span class='con-text'><b>心电监护:</b>无</span>";
                            }else{
                                cabin_information += " <span class='con-text'><b>心电监护:</b>暂无</span>";
                            }
                            cabin_information += "  <span class='con-text'><b>年龄：</b>" + o.hoArchivalInformationEntity.aiAge + "</span>";
                            cabin_information += " </div>";
                            cabin_information += "<div class='list-con'>";
                            cabin_information += " <span class='con-text'  style='width:100%!important;'><b>吸氧方式:</b>" + o.hoMedicalOrderEntity.moOxygenMode + "</span>";
                            cabin_information += " </div>";
                            cabin_information += " <div class='list-con'>";
                            cabin_information += " <span class='con-text'  style='width:100%!important;'><b  onclick='TheConduit("+o.hoMedicalOrderEntity.moTrId+","+o.hoMedicalOrderEntity.moId+")'>管道:</b> " + o.hoMedicalOrderEntity.moTheConduit + "</span>";
                            cabin_information += " </div>";
                            if (o.cfpState == 1) {
                                cabin_information += " <div class='list-con'>";
                                cabin_information += "<div class=\"aui-btn aui-btn-block aui-btn-outlined aui-btn-sm\" style=\"padding:5px 5px;font-size:16px;width:40%;\" onclick=\"updateHoCabinFrequencyPositions(" + o.cfpId + "," + o.cfpTrId + ")\">移除信息</div>";
                                cabin_information += " </div>";
                            } else {
                                //确认信息
                                cabin_information += " <div class='list-con'>";
                                cabin_information += "<div class=\"aui-btn aui-btn-block aui-btn-outlined aui-btn-sm\" style=\"padding:5px 5px;font-size:16px;width:40%;\" onclick=\"updateHoCabinFrequencyPositions(" + o.cfpId + "," + o.cfpTrId + ")\">移除信息</div>";
                                cabin_information += "<div class=\"aui-btn aui-btn-block aui-btn-outlined aui-btn-sm\" style=\"padding:5px 5px;font-size:16px;width:40%;\" onclick=\"updateHoCabinFrequencyPosition(" + o.cfpId + "," + o.cfpTrId + ")\">确认信息</div>";
                                cabin_information += " </div>";
                            }


                            cabin_information += " </div>";
                            cabin_information += " </div>";
                        } else {
                            cabin_information += "<div class='patient-wrapper' onclick=\"open_informaction(" + o.cfpId + ")\" >";
                            cabin_information += "<div class='list-top'>";
                            cabin_information += "<span><div class='circle' style='background-color:#84c1ff'>" + (i + 1) + "</div></span>";
                            cabin_information += "<span></span><span class='weizhi'></span>";
                            cabin_information += "</div>";
                            cabin_information += " <div class='patient-ex-container'>";
                            cabin_information += "</div>";
                            cabin_information += "<div style='text-align: center;margin:1.6rem auto'>";
                            cabin_information += " <strong><i style='font-size:1.6rem;text-align: center;color: #84c1ff;' class='aui-iconfont aui-icon-plus'></i></strong>";
                            cabin_information += "</div>";
                            cabin_information += "</div>";
                        }
                        $("#cfName").html("");
                        $("#cfName").html("舱次名称：" + o.hoCabinFrequencyEntity.cfName);
                        $("#cfPressure").html("");
                        $("#cfPressure").html("治疗压力：" + o.hoCabinFrequencyEntity.cfPressure);
                        $("#cfCompression").html("");
                        $("#cfCompression").html("升压时间：" + o.hoCabinFrequencyEntity.cfCompression);
                        $("#cfStablePressure").html("");
                        $("#cfStablePressure").html("稳压时间：" + o.hoCabinFrequencyEntity.cfStablePressure);
                        $("#cfDecompression").html("");
                        $("#cfDecompression").html("减压时间：" + o.hoCabinFrequencyEntity.cfDecompression);
                        $("#cfOutCabin").html("");
                        $("#cfOutCabin").html("出舱时间：" + o.hoCabinFrequencyEntity.cfOutCabin);
                        $("#cfStartTime").html("");
                        $("#cfStartTime").html("开始时间：" + o.hoCabinFrequencyEntity.cfStartTime);
                        $("#cfPressurehide").val(o.hoCabinFrequencyEntity.cfPressure);
                    })
                    /**
                     * 页面进行赋值
                     */
                    $("#cabin_information").html(cabin_information);
                } else {
                    api.hideProgress();
                    /**
                     *  弹窗提示 暂无相关信息
                     */
                    toast.fail({
                        title: "加载失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "加载失败",
                    duration: 2000
                });
            }
        });
    }

    /**
     * 查询治疗登记信息
     */
    function getHoTreatmentRegister() {
        $("#patient_information").html("");
        var jsParms = new Object();
        /**
    * 获取姓名
    */
        var hoArchivalInformationEntity = new Object();
        hoArchivalInformationEntity.aiName = $("#aiName").val();
        jsParms.hoArchivalInformationEntity = hoArchivalInformationEntity;
        /**
         * 医嘱信息实体
         * @type {Object}
         */
        var hoMedicalOrderEntity = new Object();

        /**
         * 医嘱信息状态 1.保存医嘱 2.完成医嘱
         * @type {Object}
         */
        hoMedicalOrderEntity.moStatus = 2;
        jsParms.hoMedicalOrderEntity = hoMedicalOrderEntity;
        /**
         * 记录状态 1：正常  2：暂停  3：失约  4：结束治疗
         * @type {number}
         */
        jsParms.trType = 1;
        /**
         * 获取页数
         */
        jsParms.currPage = 1;
        jsParms.pageSize = 10000;
        /**
         * 住院号
         * @type {jQuery}
         */
        // jsParms.trPatientNo = $("#trPatientNo").val();
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/businessmanagement/hotreatmentregister/getHoTreatmentRegister',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {

                /**
                 *  拼接展示信息
                 */
                var patient_information = "";
                /**
                 * 验证返回信息是否为空
                 */
                if (result.success == true) {
                    /**
                     *  循环object
                     */
                    $.each(result.data.list, function (i, o) {
                        patient_information += "<li class=\"aui-list-item aui-list-item-form font-size\">";
                        patient_information += "<div class=\"aui-list-item-inner\">";
                        patient_information += "<div class=\"aui-list-item-label\">";
                        patient_information += "<span>" + o.hoArchivalInformationEntity.aiName + "</span>";
                        patient_information += "</div>";
                        patient_information += "<div class=\"aui-list-item-label\">";
                        patient_information += "<span>" + o.hoMedicalOrderEntity.moPosition + "</span>";
                        patient_information += "</div>";
                        patient_information += "<div class=\"aui-list-item-label\">";
                        patient_information += "<span>" + o.hoMedicalOrderEntity.moOxygenMode + "</span>";
                        patient_information += "</div>";
                        patient_information += "<div class=\"aui-list-item-label\">";
                        patient_information += "<span>" + o.hoMedicalOrderEntity.moPressure + "</span>";
                        patient_information += "</div>";
                        patient_information += "<div class=\"aui-list-item-label\">";
                        patient_information += "<span onclick=\"appointmentOfPatientsPop(" + o.trId + "," + o.hoMedicalOrderEntity.moPressure + ")\">预约</span>";
                        patient_information += "||";
                        patient_information += "<span onclick=\"updateHoCabinFrequencyPositioning(" + o.trId + "," + o.hoMedicalOrderEntity.moPressure + ")\">陪舱</span>";
                        patient_information += "</div>";

                        patient_information += "</div>";
                        patient_information += "</li>";
                    })
                    /**
                     * 页面进行赋值
                     */
                    $("#patient_information").html(patient_information);
                } else {
                    api.hideProgress();
                    /**
                     *  弹窗提示 暂无相关信息
                     */
                    toast.fail({
                        title: "加载失败",
                        duration: 2000
                    });
                }

            },
            error: function (result) {
                /**
                 * 关闭加载框
                 */
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "加载失败",
                    duration: 2000
                });
            }

        });
    }


    /**
     * 查询舱内重复患者
     * @param trId
     * @param moPressure
     */
    function appointmentOfPatientsPop(trId, moPressure) {

        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = trId;

        /**
         * 压力
         */
        jsParms.moPressure = moPressure;
        /**
     * 舱次位置Id
     * @type {jQuery}
     */
    jsParms.cfpId = $("#cfpId").val();
        /**
         * 舱次位置Id
         * @type {jQuery}
         */
        jsParms.cfpCfId = api.pageParam.F_id;
        if (jsParms.moPressure == $("#cfPressurehide").val()) {
            /**
             * 请求控制器
             */
            $.ajax({
                url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/repeatPeople',
                type: 'post',
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(jsParms),
                success: function (result) {
                    /**
                     * 验证是否成功
                     */
                    if (result.length > 0) {
                        /**
                         *  循环object
                         */
                        $.each(result, function (i, o) {
                            /**
                             * 判断当前舱内医生排舱时是否有重复的患者
                             * 如果小于1 舱内没有重复的患者可以进入排舱的修改方法 相反 则进不去
                             */
                            if (o.repeatPeople < 1) {
                                /**
                                 * 医生预约患者
                                 */
                                appointmentOfPatients(trId, moPressure)
                            } else {
                                api.alert({
                                    title: '温馨提示:',
                                    msg: '舱内存在此患者',
                                });
                            }
                        });
                    } else {
                        api.alert({
                            title: '温馨提示:',
                            msg: '操作失败',
                        });
                    }
                },
                error: function (result) {
                    api.alert({
                        title: '温馨提示:',
                        msg: '操作失败',
                    });
                }

            });
        } else {
            api.alert({
                title: '温馨提示:',
                msg: '患者治疗压力与舱次压力不同',
            });

        }
    }

    /**
     * 修改人员排舱位置信息
     */
    function appointmentOfPatients(trId, moPressure) {
        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = trId;

        /**
        * 医生预约 
        */
        jsParms.type = 3;

        /**
         * 舱次位置Id
         * @type {jQuery}
         */
        jsParms.cfpId = $("#cfpId").val();
        /**
         * 患者治疗压力
         * @type {jQuery}
         */
        jsParms.moPressure = moPressure;
        /**
         * 舱次压力
         * @type {jQuery}
         */
        jsParms.cfPressure = $("#cfPressurehide").val();
        /**
        * 判断患者压力是否与舱次相匹配
        */
        if (jsParms.moPressure == jsParms.cfPressure) {
            /**
             * 请求控制器
             */
            $.ajax({
                url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/updateHoCabinFrequencyPosition',
                type: 'post',
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(jsParms),
                success: function (result) {
                    /**
                     * 验证是否成功
                     */
                    if (result.success == true) {
                        toast.loading({
                            title: "提交中...",
                            duration: 20000
                        }, function (ret) {
                            //重新加载当前页面
                            reloadPatient();
                            setTimeout(function () {
                                toast.hide();
                            }, 3000)
                        });
                    } else {
                        /**
                         *  提示错误信息
                         */
                        toast.fail({
                            title: "加载失败",
                            duration: 2000
                        });
                        //清空舱次位置id
                        $("#cfpId").val("0");
                    }
                },
                error: function (result) {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "加载失败",
                        duration: 2000
                    });
                    //清空舱次位置id
                    $("#cfpId").val("0");
                }
            });
        } else {
            api.alert({
                title: '温馨提示:',
                msg: '舱次压力与患者治疗压力不同',
            });
        }
    }



    function reloadPatient() {
        //执行关闭患者信息窗口
        Cancel();
        window.location.reload();
    }

    function closewin() {
        api.closeWin({
            name: 'patient'
        });
    }


    //取消按钮
    function Cancel() {
        // vm.AddPersonnel = false;
        $('#cabin-info').hide();
    }
    function open_informaction(cfpId) {
        api.actionSheet({
            title: '请选择排舱方式',
            cancelTitle: '取消',
            buttons: ['扫码排舱', '选择患者']
        }, function (ret, err) {
            if (ret) {
                /**
                 * 如果为扫码排舱走以下方法
                 */
                if (ret.buttonIndex == 1) {
                    var FNScanner = api.require('FNScanner');
                    FNScanner.openScanner({
                        autorotation: true
                    }, function (information, error) {
                        // alert(JSON.stringify(information));
                        if (information.eventType == "success") {
                            /**
                             * 获取条码中信息
                             */
                            var trId = information.content;
                            var cfPressure = $("#cfPressurehide").val();
                            /**
                             * 调用校验压力方法
                             * HoCabinFrequencyPosition方法入参：trId：患者治疗登记id cfPressure舱内压力
                            */
                            appointmentOfPatients(trId, cfPressure);
                        } else {
                            console.log("错误信息" + error);
                        }
                    });
                }
                /**
                 *如果为选择患者则走以下方法
                 * 
                 */
                else if (ret.buttonIndex == 2) {
                    $("#cfpId").val(cfpId);
                    $('#cabin-info').show();
                }
                /**
                  *如果两条件都不满足则默认跳出 
                  * 
                  */
                else {
                    return;
                }


            }
        });
    }

    /**
* 扫码查询舱内重复患者
* @param trId
* @param moPressure
*/
    function appointmentOfPatients(trId, moPressure) {

        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = trId;
        /**
         * 舱次位置Id
         * @type {jQuery}
         */
        jsParms.cfpCfId = api.pageParam.F_id;
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/repeatPeople',
            type: 'post',
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                /**
                 * 验证是否成功
                 */
                if (result.length > 0) {
                    /**
                     *  循环object
                     */
                    $.each(result, function (i, o) {
                        /**
                         * 判断当前舱内医生排舱时是否有重复的患者
                         * 如果小于1 舱内没有重复的患者可以进入排舱的修改方法 相反 则进不去
                         */
                        if (o.repeatPeople < 1) {
                            /**
                             * 扫码排舱判断舱次压力与患者治疗压力是否相同
                             */
                            HoCabinFrequencyPosition(trId, moPressure)
                        } else {
                            api.alert({
                                title: '温馨提示:',
                                msg: '舱内存在此患者',
                            });
                        }
                    });
                } else {
                    api.alert({
                        title: '温馨提示:',
                        msg: '操作失败',
                    });
                }
            },
            error: function (result) {
                api.alert({
                    title: '温馨提示:',
                    msg: '操作失败',
                });
            }
        });
    }






    /**
 * 扫码排舱判断舱次压力与患者治疗压力是否相同
 * @param cfpId 舱次位置Id
 * @param cfpCfId 舱次位置舱次Id
 */
    function HoCabinFrequencyPosition(trId, cfPressure) {
        api.showProgress({
            title: '校对中...',
            text: '',
            modal: true
        });
        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.trId = trId;
        /**
         * 舱次压力
         */
        jsParms.cfPressure = cfPressure;
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/businessmanagement/hotreatmentregister/getHoTreatmentRegister',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                /**
                 * 关闭加载框
                 */
                api.hideProgress();
                /**
                 * 验证返回信息是否为空
                 */

                if (result.success == true) {
                    /**
                     *  循环object
                     */
                    $.each(result.data.list, function (i, o) {
                        /**
                         * 判断治疗登记是否正常
                         */
                        if (o.trType == 1) {
                            /**
                             * 判断医嘱是否有信息
                             */
                            if (o.hoMedicalOrderEntity != null) {
                                /**
                                 * 判断医嘱状态是否完成医嘱
                                 */
                                if (o.hoMedicalOrderEntity.moStatus == 2) {
                                    /**
                                     * 判断患者压力与舱室压力是否相同
                                     */
                                    if (jsParms.cfPressure == o.hoMedicalOrderEntity.moPressure) {
                                        /**
                                         * 扫码排舱
                                         */
                                        updateHoCabin(trId, cfPressure);
                                    } else {
                                        /**
                                         * 操作提醒
                                         */
                                        toast.fail({
                                            title: "舱室压力与治疗压力不同",
                                            duration: 2000
                                        });

                                    }
                                } else {
                                    /**
                                     * 操作提醒
                                     */
                                    toast.fail({
                                        title: "患者未下医嘱",
                                        duration: 2000
                                    });

                                }
                            } else {
                                /**
                                 * 操作提醒
                                 */
                                toast.fail({
                                    title: "患者未下医嘱",
                                    duration: 2000
                                });
                            }
                        } else if (o.trType == 2) {
                            /**
                             * 操作提醒
                             */
                            toast.fail({
                                title: "该患者已暂停",
                                duration: 2000
                            });

                        } else if (o.trType == 3) {
                            /**
                             * 操作提醒
                             */
                            toast.fail({
                                title: "该患者已失约",
                                duration: 2000
                            });

                        } else if (o.trType == 4) {
                            /**
                             * 操作提醒
                             */
                            toast.fail({
                                title: "该患者已结束治疗",
                                duration: 2000
                            });

                        }
                    });
                } else {
                    /**
                     *  弹窗提示 暂无相关信息
                     */
                    toast.fail({
                        title: "暂无相关信息",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                /**
                 * 关闭加载框
                 */
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "操作失败",
                    duration: 2000
                });
            }
        });
    }


    /**
     * 陪舱人员修改人员排舱位置信息
     * 
     */
    function updateHoCabinFrequencyPositioning(trId, moPressure) {
        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = trId;
        /**
         * 获取患者治疗压力
         */
        jsParms.moPressure = moPressure;
        /**
         * 2 陪护
         */
        jsParms.type = 2;
        /**
         * 陪舱标识
         */
        jsParms.cfpEscortCabin = 1;
        /**
         * 舱次位置Id
         * @type {jQuery}
         */
        jsParms.cfpId = $("#cfpId").val();
        /**
        * 舱次压力
        * @type {jQuery}
        */
        jsParms.cfPressure = $("#cfPressurehide").val();
        /**
         * 判断患者压力是否与舱次相匹配
         */
        if (jsParms.moPressure == jsParms.cfPressure) {
            /**
           * 请求控制器
           */
            $.ajax({
                url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/updateHoCabinFrequencyPosition',
                type: 'post',
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(jsParms),
                success: function (result) {
                    /**
                   * 验证是否成功
                   */
                    if (result.success == true) {
                        /**
                         * 操作成功提醒
                         */
                        toast.success({
                            title: "操作成功",
                            duration: 1000
                        });
                        window.location.reload();

                    } else {
                        /**
                          * 操作失败提醒
                          */
                        toast.success({
                            title: "操作失败",
                            duration: 1000
                        });
                        window.location.reload();

                    }
                },
                error: function (result) {
                    api.hideProgress();
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "操作失败",
                        duration: 2000
                    });
                }
            })
        } else {
            api.alert({
                title: '温馨提示:',
                msg: '舱次压力与患者治疗压力不同',
            });
        }
    }

    /**
     * 扫码添加舱内人员
     */
    function updateHoCabin(trId, cfPressure) {
        api.showProgress({
            title: '添加中...',
            text: '',
            modal: true
        });
        var jsParms = new Object();
        /**
         * 状态为1时
         * @type {number}
         */
        jsParms.type = 1;
        /**
         * 
         */
        jsParms.cfpTrId = trId;
        /**
         * 赋值舱次Id
         * @type {jQuery}
         */
        jsParms.cfpCfId = api.pageParam.F_id;
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/ScanCode',
            type: 'post',
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                api.hideProgress();
                /**
                 * 验证是否成功
                 */
                if (result > 0) {
                    /**
                     * 操作成功提醒
                     */
                    toast.success({
                        title: "添加成功",
                        duration: 1000
                    });
                    window.location.reload();

                } else {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "添加失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "操作失败",
                    duration: 2000
                });
            }
        });
    }


    /**
     * 移除舱次位置信息
     * @param cfpId 舱次位置信息唯一标识
     * @param cfpTrId 治疗登记唯一标识
     */
    function updateHoCabinFrequencyPositions(cfpId, cfpTrId) {
        api.showProgress({
            title: '移除中...',
            text: '',
            modal: true
        });
        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = cfpTrId;

        /**
         * 赋值排舱位置Id
         */
        jsParms.cfpId = cfpId;

        /**
         * 操作类型 （0： 添加位置人员信息     1：移除舱次位置人员信息）
         */
        jsParms.type = 1;
        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/updateHoCabinFrequencyPosition',
            type: 'post',
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                /**
                 * 验证是否成功
                 */
                if (result.success == true) {
                    /**
                     * 操作成功提醒
                     */
                    toast.success({
                        title: "移除成功",
                        duration: 1000
                    });
                    window.location.reload();

                } else {
                    api.hideProgress();
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "操作失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "操作失败",
                    duration: 2000
                });
            }
        });
    }

    /**
     * 修改人员排舱位置信息(确认信息)
     */
    function updateHoCabinFrequencyPosition(cfpId, cfpTrId) {
        api.showProgress({
            title: '确认中...',
            text: '',
            modal: true
        });
        var jsParms = new Object();
        /**
         * 赋值治疗登记Id
         */
        jsParms.cfpTrId = cfpTrId;

        /**
         * 赋值排舱位置Id
         */
        jsParms.cfpId = cfpId;

        /**
         * 请求控制器
         */
        $.ajax({
            url: Url_IP + '/disinfectioninspection/hocabinfrequencyposition/updateHoCabinFrequencyPosition',
            type: 'post',
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(jsParms),
            success: function (result) {
                /**
                 * 验证是否成功
                 */
                if (result.success == true) {
                    /**
                     * 操作成功提醒
                     */
                    toast.success({
                        title: "移除成功",
                        duration: 1000
                    });
                    window.location.reload();

                } else {
                    api.hideProgress();
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "操作失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                api.hideProgress();
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "操作失败",
                    duration: 2000
                });
            }
        });
    }

    /**
    *  
    * 不安全因素
    * */
    function unsafeFactorsFrame(aaTrId) {
        api.openWin({
            name: 'unsafe_factors_frame',
            url: './unsafe_factors_frame.html',
            pageParam: {
                name: 'unsafe_factors_frame',
                F_ID: aaTrId
            },
        });
    }

    /**
     *  
     * 并发症
     * */
    function complicationFrame(cfpCfId, cfpTrId) {
        api.openWin({
            name: 'complication_frame',
            url: './complication_frame.html',
            pageParam: {
                name: 'complication_frame',
                cfpCfId: cfpCfId,
                cfpTrId: cfpTrId
            },
        });
    }

    /**
     *  
     * 添加舱次
     * */
    function cabinfRequencyPositionFrame() {
        api.openWin({
            name: 'cabinf_requency_position_frame',
            url: './cabinf_requency_position_frame.html',
            pageParam: {
                name: 'cabinf_requency_position_frame',
                cfId: api.pageParam.F_id,

            },
        });
    }

     /**
     *  
     * 管道
     * */
     function TheConduit(moTrId,moId) {
        api.openWin({
            name: 'The_Conduit_header',
            url: './The_Conduit_header.html',
            pageParam: {
              name: 'The_Conduit_header',
              moTrId:moTrId,
              moId:moId,
          }
        });
    }
    /**
     *  
     * 添加管道
     * */
    // function TheConduitFrame() {
    //     api.openWin({
    //         name: 'The_Conduit_frame',
    //         url: './The_Conduit_frame.html',
    //         pageParam: {
    //             name: 'The_Conduit_frame',
    //             cfId: api.pageParam.F_id,

    //         },
    //     });
    // }
</script>